﻿@model PagedList.IPagedList<File_Manager.Models.Post_CYT>

@{
    ViewBag.Title = "Listado Consultas";
}
<script type="text/javascript">
    function justNumbers(e) {
        var keynum = window.event ? window.event.keyCode : e.which;
        if ((keynum == 8))
            return true;

        return /\d/.test(String.fromCharCode(keynum));
    }
</script>
<h2>Listado de Consultas</h2>
<div class="error">
@ViewBag.msn
</div>
<br />
    @using (Html.BeginForm())
    {   
            <table width="100%">
                    <tr>
                        <td width="33%">
                             N° Ticket:<br />  @Html.TextBox("SearchId", ViewBag.CurrentId as string, new { onkeypress = "return justNumbers(event);" }) &nbsp;
                        </td>
                        <td width="33%">
                            Asunto: <br />  @Html.TextBox("SearchAsunto", ViewBag.CurrentAsunto as string) &nbsp;
                        </td>
                        <td width="33%">
                             Status:<br /> @Html.DropDownList("SearchStatus", "-- Seleccione Opción --")
                        </td>
                    </tr>
            </table><br />
         <input type="submit" value="Filtrar" />
    }
</br>
@if (ViewBag.postPending == 0)
{
    <p>
        <a href="/Post_CYT/Create"><img src="../../Content/images/NewPost.png" /></a> <b>@Html.ActionLink("NUEVO Ticket Soporte", "Create")</b>
    </p>
}
else
{
    <p> Debe Esperar que se le responda el Ticket Pendiente, para Crear uno Nuevo.</p>
}
 
<table width="100%">
    <tr>
        <th>
            N° Ticket
        </th>
        <th>
            Usuario Remitente
        </th>
        <th>
            Asunto Mensaje
        </th>
        <th>
            Fecha Consulta
        </th>
        <th>
            Status
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.id)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.userName)
        </td>
        <td width="30%">
            @Html.DisplayFor(modelItem => item.asunto)
        </td>

        <td>
            @Html.DisplayFor(modelItem => item.dateGuest)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.nStatus.name)
        </td>
        <td>
            @*Html.ActionLink("Edit", "Edit", new { id=item.id }) |*@
            @Html.ActionLink("Leer", "Details", new { id = item.id })
            @*Html.ActionLink("Delete", "Delete", new { id=item.id })*@
        </td>
    </tr>
}

</table>

<div>
    Pag @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    de @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<= ", "SearchIndexG", new { page = 1, SearchAsunto = ViewBag.CurrentAsunto, SearchStatus = ViewBag.CurrentStatus, SearchId = ViewBag.CurrentId })
        @Html.Raw("&nbsp;");
        @Html.ActionLink("<=", "SearchIndexG", new { page = Model.PageNumber - 1, SearchAsunto = ViewBag.CurrentAsunto, SearchStatus = ViewBag.CurrentStatus, SearchId = ViewBag.CurrentId })
    }
    else
    {
        @:<<=
        @Html.Raw("&nbsp;");
        @:<=
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("=>", "SearchIndexG", new { page = Model.PageNumber + 1, SearchAsunto = ViewBag.CurrentAsunto, SearchStatus = ViewBag.CurrentStatus, SearchId = ViewBag.CurrentId })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(" =>>", "SearchIndexG", new { page = Model.PageCount, SearchAsunto = ViewBag.CurrentAsunto, SearchStatus = ViewBag.CurrentStatus, SearchId = ViewBag.CurrentId })
    }
    else
    {
        @:=>
        @Html.Raw("&nbsp;")
        @:=>>
    }
</div>